package com.tr.rentcar.controller.userc;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tr.rentcar.model.bean.Employee;
import com.tr.rentcar.model.bean.Order;
import com.tr.rentcar.model.dao.EmployeeDao;
import com.tr.rentcar.model.dao.OrderDao;

/**
 * Servlet implementation class MainController
 */
@WebServlet("/main")
public class MainController extends HttpServlet {
	OrderDao od=new OrderDao();
	EmployeeDao ed=new EmployeeDao();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try {
			List<Order> Order=od.findByState("未处理");
			request.setAttribute("Order", Order);
			Long shu=od.getAllCountByState("未处理");
			request.setAttribute("shu", shu);
			List<Employee> elist=ed.getAllByFree();
			request.setAttribute("elist", elist);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		request.getRequestDispatcher("/WEB-INF/jsp/main.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

}
